# -*- coding: utf-8 -*-
import uuid
import enum
from sqlalchemy import Column,String,Integer,Text,Binary,Boolean,DateTime,Enum,BigInteger,BIGINT
from adminApp.extensions import db
from .base import BaseModel


class NetWorkCard(BaseModel, db.Model):
    '''设备网卡'''
    nic_name = Column(String(64))
    connection_type = Column(String(32))
    ipv4addr = Column(String(32))
    ipv6addr = Column(String(128))
    netmask = Column(String(32))
    gateway = Column(String(32))
    dns1 = Column(String(32))
    dns2 = Column(String(32))
    mac = Column(String(128))
    uuid = Column(String(128))
    link_detected = Column(String(32))
    # 管理网络
    is_mag = Column(Boolean, default=False)
    # wan口 流量口
    is_wan = Column(Boolean, default=False)

    machine_id = db.Column(db.Integer, db.ForeignKey('machine.id', ondelete='CASCADE'), nullable=False, index=True)
    machine = db.relationship('Machine', back_populates='network_cards')